home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr11 / pdox693.zip / TI1243.ASC < prev    next >
Text File  |  1993-01-29  |  9KB  |  265 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.   PRODUCT  :  Paradox                               NUMBER  :  1243
  8.   VERSION  :  All
  9.        OS  :  DOS
  10.      DATE  :  January 29, 1993                         PAGE  :  1/4
  11.  
  12.     TITLE  :  Performing Copy and Paste Functions of Calculated
  13.               Field Expressions By Using the PAL SETKEY Command
  14.  
  15.  
  16.  
  17.  
  18.   Intended Audience:
  19.   This Technical Information sheet is intended for someone with a
  20.   moderate level of Paradox experience and an aptitude for using
  21.   PAL.
  22.  
  23.   Prerequisites:
  24.   A basic understanding of the Paradox Report Generator and
  25.   experience in creating calculated fields.
  26.  
  27.   Purpose:
  28.   This Technical Information sheet illustrates how the PAL SETKEY
  29.   command can be used to create keyboard macros that perform copy
  30.   and paste functions of Calculated Field expressions.  The
  31.   keyboard macros presented in this Technical Information sheet are
  32.   intended for use on Calculated Fields only.  They do not function
  33.   on Summary Calculated Fields.
  34.  
  35.  
  36.   It is sometimes desirable to copy a calculated field expression
  37.   in either a form or report to another calculated field.  One
  38.   possible way to accomplish this operation is to use the PAL
  39.   SETKEY command to create keyboard macros which will perform copy
  40.   and paste functions.  The SETKEY command attaches a sequence of
  41.   one or more commands to the key you specify.  These keys must be
  42.   specified as a valid PAL keycode expression as defined in
  43.   Appendix G in the PAL Reference Guide (for versions earlier than
  44.   4.0, refer to Appendix B in the PAL User's Guide).  When the key
  45.   (or key combination) is pressed, the commands are executed.  A
  46.   sequence of commands that are defined in this way are called
  47.   "keyboard macros".  For additional information on keyboard
  48.   macros, refer to Chapter 20 of the PAL Programmer's Guide (for
  49.   versions earlier than 4.0, refer to the Chapter 16 of the PAL
  50.   User's Guide).
  51.  
  52.   The PAL script on the following page sets up two keyboard macros;
  53.   one that copies a calculated field expression (of a form or
  54.   report) to a variable called copyvar and one that pastes the
  55.   variable copyvar into a new calculated field (of a form or
  56.   report).
  57.  
  58.   NOTE: The keyboard macros in this Technical Information sheet are
  59.   intended for use on Calculated Fields only.  They do not function
  60.   on Summary Calculated Fields.
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.   PRODUCT  :  Paradox                               NUMBER  :  1243
  74.   VERSION  :  All
  75.        OS  :  DOS
  76.      DATE  :  January 29, 1993                         PAGE  :  2/4
  77.  
  78.     TITLE  :  Performing Copy and Paste Functions of Calculated
  79.               Field Expressions By Using the PAL SETKEY Command
  80.  
  81.  
  82.  
  83.  
  84.   To create a PAL script:
  85.  
  86.      1.  From the Paradox Main Menu, select:
  87.  
  88.              -  Scripts
  89.              -  Editor
  90.              -  New (Write for versions earlier than 4.0)
  91.  
  92.      2.  At the prompt, type "Calc-cpy" as the name of the script
  93.  
  94.      3.  Type in the following PAL code:
  95.  
  96.          SETKEY 3 If SYSMODE()="Form" or SYSMODE()="Report" Then
  97.          Menu {Field} {CalcEdit} Enter copyvar=MENUCHOICE() Menu
  98.          Esc Endif
  99.  
  100.          SETKEY 16 If SYSMODE()="Form" or SYSMODE()="Report" and
  101.          ISBLANK(copyvar) = False Then Menu {Field} {Place}
  102.          {Calculated} TYPEIN copyvar Endif
  103.  
  104.          Each SETKEY statement above is split onto more than one
  105.          line because of formatting.  Note: In your PAL script each
  106.          SETKEY statement must be typed on a single line (it can't
  107.          continue onto multiple lines).  If your entire macro won't
  108.          fit on a single line, place the commands in a script and
  109.          let the macro consist of a single PLAY command.
  110.  
  111.   When you are finished typing in the above PAL code, press <F2> to
  112.   save the script.
  113.  
  114.   The first keyboard macro in the script assigns the PAL code to
  115.   <Ctrl-C> (where 3 is the extended code for <Ctrl-C>).  When
  116.   <Ctrl-C> is pressed, the setkey macro does the following:
  117.  
  118.      1.  Checks to see if Paradox is in Form or Report mode.
  119.  
  120.      2.  If Paradox is in Form or Report mode, the keyboard macro
  121.          copies the calculated field expression to the variable
  122.          copyvar.  If Paradox is not in Form or Report mode, the
  123.          keyboard macro will not do anything.
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.   PRODUCT  :  Paradox                               NUMBER  :  1243
  140.   VERSION  :  All
  141.        OS  :  DOS
  142.      DATE  :  January 29, 1993                         PAGE  :  3/4
  143.  
  144.     TITLE  :  Performing Copy and Paste Functions of Calculated
  145.               Field Expressions By Using the PAL SETKEY Command
  146.  
  147.  
  148.  
  149.  
  150.          NOTE: In order to copy a calculated field expression with
  151.          <Ctrl-C>, it is first necessary to position the cursor on
  152.          a calculated field.  If the cursor is not positioned on a
  153.          calculated field and you press <Ctrl-C>, the variable
  154.          copyvar will be a blank string.  <Ctrl-C> is just one
  155.          possible keycode that you could use for the first setkey
  156.          macro.  See Appendix G of the PAL Reference Guide for a
  157.          list of Keycodes Recognized by Paradox (for versions
  158.          earlier than 4.0, refer to Appendix B of the PAL User's
  159.          Guide).
  160.  
  161.   The second keyboard macro in the script assigns the PAL code to
  162.   <Ctrl-P> (where 16 is the extended code for <Ctrl-P>).  When
  163.   <Ctrl-P> is pressed, the setkey macro does the following:
  164.  
  165.      1.  Checks to see if Paradox is in Form or Report mode.
  166.  
  167.      2.  If Paradox is in Form or Report mode, it creates a
  168.          calculated field and types in the value of the variable
  169.          copyvar as the calculated expression.  If the variable
  170.          copyvar is a blank string (this would happen if you
  171.          pressed <Ctrl-C> on a regular field instead of a
  172.          calculated field), the second keyboard macro will not do
  173.          anything.
  174.  
  175.      3.  At this point, you may add to or modify the current
  176.          expression.  When you are finished, press <Enter>.  Once
  177.          you have accepted the expression, you will need to adjust
  178.          the field size.  If you are in a report and your
  179.          expression contains PAL functions, you will need to
  180.          reformat the field mask to the appropriate number of
  181.          characters.
  182.  
  183.      4.  If Paradox is not in Form or Report mode, the keyboard
  184.          macro will not do anything.
  185.  
  186.          NOTE: In order to paste the copied calculated field
  187.          expression, it is first necessary to be in Form or Report
  188.          mode and to position the cursor at the location where you
  189.          want the calculated field.
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.   PRODUCT  :  Paradox                               NUMBER  :  1243
  206.   VERSION  :  All
  207.        OS  :  DOS
  208.      DATE  :  January 29, 1993                         PAGE  :  4/4
  209.  
  210.     TITLE  :  Performing Copy and Paste Functions of Calculated
  211.               Field Expressions By Using the PAL SETKEY Command
  212.  
  213.  
  214.  
  215.  
  216.   To play the script:
  217.  
  218.      1.  From the Paradox Main Menu, select Scripts | Play
  219.  
  220.      2.  Type "Calc-cpy" as the name of the script
  221.  
  222.   NOTE: When you play the script "Calc-cpy", Paradox reads the
  223.   SETKEY statements into memory for that Paradox session or until
  224.   the key is redefined.  When you exit out of Paradox, the SETKEYs
  225.   are disabled and the next time you start up Paradox, they remain
  226.   inactive until you play the "Calc-cpy" script.
  227.  
  228.   To enable SETKEYs every time you start Paradox, you can define
  229.   the SETKEYs in a script called "Init" (located in the same
  230.   directory as your Paradox program files or the private directory
  231.   if you are using Paradox on a network).  The Init script is a
  232.   Paradox program that runs automatically when Paradox is started
  233.   (like an Autoexec.bat file runs automatically when a computer is
  234.   booted).  For additional information about Init scripts, refer to
  235.   Chapter 7 of the PAL Programmer's Guide (for versions earlier
  236.   than 4.0, refer to Chapter 7 of the PAL User's Guide).
  237.  
  238.  
  239.   For additional information on PAL, refer to the PAL Reference
  240.   Guide (for Paradox versions earlier than 4.0, refer to the PAL
  241.   User's Guide).
  242.  
  243.  
  244.   DISCLAIMER: You have the right to use this technical information
  245.   subject to the terms of the No-Nonsense License Statement that
  246.   you received with the Borland product to which this information
  247.   pertains.
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.